import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter)

// 导入组件
import MyLogin from '@/views/MyLogin'
import MyHome from '@/views/MyHome'
import MyVideo from '@/views/MyVideo'

// 准备路由规则
const routes = [
    { name: 'MyLogin', path: '/login', component: MyLogin },
    { name: 'MyHome', path: '/home', component: MyHome },

    // 后面的/:id不是说路径写 /video/:id，而是说:id的位置要传递一个参数id
    // 例如： /video/110
    { name: 'MyVideo', path: '/video/:id/:name', component: MyVideo },
]


// 实例化路由对象
const router = new VueRouter({
    routes,
})


// 暴露出这个对象
export default router